<?php
namespace app\controller;

use think\facade\View;

use app\controller\Base;
use app\model\ProductsWire;
use app\model\ProductsSurface;
use app\model\ProductsWearPlate;

class Product extends Base
{
    protected $wireTypes = ["", "热喷涂粉芯丝材","耐磨热喷涂材料","打底热喷涂材料"];

    // 热喷涂
    public function wire()
    {
        return View::fetch();
    }

    public function wirelist($type = 0)
    {
        $list = ProductsWire::where('wire_type', $type)->order('sort desc')->select();

        View::assign('wireType', $this->wireTypes[$type]);

        View::assign('list', $list);

        return View::fetch();
    }

    public function surface()
    {
        return View::fetch();
    }

    public function surfacelist()
    {
        $list = ProductsSurface::select();

        View::assign('list', $list);

        return View::fetch();
    }

    public function wearPlate()
    {
        $list = ProductsWearPlate::select();

        View::assign('list', $list);

        return View::fetch();
    }

    public function __call($method, $args)
    {    
        $pathinfo = $this->app->request->pathinfo();
        $pathinfo = str_replace('.html','',str_replace('/', '_', $pathinfo));

        return View::fetch($pathinfo);
    }
}
